﻿<Window x:Class="Writespace.Dialogs.OptionsWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:local="clr-namespace:Writespace.Dialogs.Properties"
        xmlns:Dialogs="clr-namespace:Writespace.Dialogs"
        WindowStartupLocation="CenterScreen"
        Title="Writespace - Options"
        WindowStyle="None"
        ResizeMode="NoResize"
        AllowsTransparency="True"
        Width="760"
        Height="366"
        Background="Transparent"
        ShowInTaskbar="True"
        Loaded="Window_Loaded">

    <Window.Resources>
        <!-- Settings -->
        <local:Settings x:Key="Settings" />

        <!-- Collections from code classes -->
        <CollectionViewSource Source="{Binding Source={x:Static Fonts.SystemFontFamilies}}"
                              x:Key="myFonts" />
        <ObjectDataProvider x:Key="colors"
                            ObjectType="{x:Type Dialogs:ColorHelper}"
                            MethodName="GetColorNames" />
        <ObjectDataProvider x:Key="fonts"
                            ObjectType="{x:Type Dialogs:FontHelper}"
                            MethodName="GetFontNames" />
        <ObjectDataProvider x:Key="sizes"
                            ObjectType="{x:Type Dialogs:SizeHelper}"
                            MethodName="GetFontSizes" />
        <ObjectDataProvider x:Key="margins"
                            ObjectType="{x:Type Dialogs:MarginHelper}"
                            MethodName="GetMarginSizes" />
        <ObjectDataProvider x:Key="alignments"
                            ObjectType="{x:Type Dialogs:AlignmentsHelper}"
                            MethodName="GetAlignments" />
    </Window.Resources>

    <!-- the main, transparent background -->
    <Grid DataContext="{StaticResource Settings}"
          x:Name="LayoutRoot"
          Background="Transparent">
        <!-- the grid with all big rows and columns -->
        <Grid  Margin="10,16,10,4">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="0.5*" />
                <ColumnDefinition Width="0.5*" />
            </Grid.ColumnDefinitions>
            <Grid.RowDefinitions>
                <RowDefinition Height="40" />
                <RowDefinition Height="200" />
            </Grid.RowDefinitions>

            <Rectangle Stroke="#FF111111"
                       StrokeThickness="3"
                       RadiusX="5"
                       RadiusY="5"
                       Grid.ColumnSpan="2"
                       Grid.RowSpan="2"
                       Margin="0,0,0,-71">
                <Rectangle.BitmapEffect>
                    <OuterGlowBitmapEffect GlowColor="#7F000000"
                                           GlowSize="15"
                                           Opacity="0.3" />
                </Rectangle.BitmapEffect>
                <Rectangle.Fill>
                    <LinearGradientBrush EndPoint="0.5,-2.453"
                                         StartPoint="0.5,2.847">
                        <GradientStop Color="Gray"
                                      Offset="0" />
                        <GradientStop Color="Black"
                                      Offset="1" />
                    </LinearGradientBrush>
                </Rectangle.Fill>

            </Rectangle>

            <TextBlock Grid.Column="1"
                       Grid.Row="0"
                       HorizontalAlignment="Left"
                       Margin="20,0,0,0"
                       VerticalAlignment="Bottom"
                       FontSize="16"
                       FontWeight="Bold"
                       Foreground="LightGreen"
                       Text="Font Options" />

            <TextBlock HorizontalAlignment="Left"
                       VerticalAlignment="Top"
                       TextWrapping="Wrap"
                       Foreground="#FFD1D1D1"
                       Grid.Column="0"
                       Grid.Row="1"
                       Margin="20,10,20,0"
                       FontSize="14">
                    <LineBreak />
                    <LineBreak />
                <Run Text="A fullscreen editing environment for Word." /><LineBreak />
                    <LineBreak />
                <Run Text="For support, feedback and full source code, go to " /><LineBreak />
                <Bold><Hyperlink TextDecorations=""
                                 Click="CodeplexLink_Click"
                                 x:Name="CodeplexLink">
                    <Run Foreground="#FFeeeeee"
                         Text="http://www.codeplex.com/writespace" /></Hyperlink></Bold>
                <LineBreak />
            </TextBlock>
            <TextBlock x:Name="VersionInfo"
                       VerticalAlignment="Bottom"
                       TextWrapping="Wrap"
                       Foreground="#FFD1D1D1"
                       Grid.Row="1"
                       Margin="20,0,31.614,35"
                       FontSize="14"
                       Height="18.62">Version ...</TextBlock>
           
            <StackPanel Grid.Column="1"
                        Grid.Row="1"
                        Margin="5,5,5,-33">
              
                <StackPanel Margin="2" Orientation="Horizontal">
                    <Label Content="FontSize:"
                           Foreground="#FFD1D1D1"
                           Width="80"
                           HorizontalAlignment="Right"
                           FontWeight="Bold" />
                    <ComboBox SelectedValue="{Binding Path=Default.FontSize}"
                              ItemsSource="{Binding Source={StaticResource sizes}}"
                              Width="50">
                        <ComboBox.ItemTemplate>
                            <DataTemplate>
                                <StackPanel Margin="1"
                                            Orientation="Horizontal">
                                    <TextBlock Text="{Binding}" />
                                </StackPanel>
                            </DataTemplate>
                        </ComboBox.ItemTemplate>
                    </ComboBox>
                </StackPanel>

                <StackPanel Margin="2" Orientation="Horizontal">
                    <Label FontWeight="Bold"
                           Foreground="#FFD1D1D1"
                           Content="FontFamily:"
                           Width="80"
                           HorizontalAlignment="Right" />
                    <ComboBox x:Name="FontChooser"
                              ItemsSource="{Binding Source={StaticResource fonts}}"
                              SelectedValue="{Binding Path=Default.FontFamily}"
                              Width="250">
                        <ComboBox.ItemsPanel>
                            <ItemsPanelTemplate>
                                <VirtualizingStackPanel />
                            </ItemsPanelTemplate>
                        </ComboBox.ItemsPanel>
                        <ComboBox.ItemTemplate>
                            <DataTemplate>
                                <TextBlock Text="{Binding}"
                                           FontFamily="{Binding}" />
                            </DataTemplate>
                        </ComboBox.ItemTemplate>
                    </ComboBox>
                </StackPanel>

                <StackPanel Margin="2" Orientation="Horizontal">
                    <Label FontWeight="Bold"
                           Foreground="#FFD1D1D1"
                           Content="FontColor:"
                           Width="80"
                           HorizontalAlignment="Right" />
                    <ComboBox SelectedValue="{Binding Path=Default.Color}"
                              ItemsSource="{Binding Source={StaticResource colors}}"
                              Width="250">
                        <ComboBox.ItemTemplate>
                            <DataTemplate>
                                <StackPanel Margin="1"
                                            Orientation="Horizontal">
                                    <Rectangle Fill="{Binding}"
                                               Height="10"
                                               Width="10"
                                               Margin="2" />
                                    <TextBlock Text="{Binding}"
                                               Margin="2 0 0 0" />
                                </StackPanel>
                            </DataTemplate>
                        </ComboBox.ItemTemplate>
                    </ComboBox>

                </StackPanel>
                <StackPanel Margin="2" Orientation="Horizontal">
                    <Label FontWeight="Bold"
                           Foreground="#FFD1D1D1"
                           Content="Background:"
                           Width="80"
                           HorizontalAlignment="Right" />
                    <ComboBox SelectedValue="{Binding Source={x:Static local:Settings.Default}, Path=BackgroundColor}"
                              ItemsSource="{Binding Source={StaticResource colors}}"
                              Width="250">
                        <ComboBox.ItemTemplate>
                            <DataTemplate>
                                <StackPanel Margin="1"
                                            Orientation="Horizontal">
                                    <Rectangle Fill="{Binding}"
                                               Height="10"
                                               Width="10"
                                               Margin="2" />
                                    <TextBlock Text="{Binding}"
                                               Margin="2 0 0 0" />
                                </StackPanel>
                            </DataTemplate>
                        </ComboBox.ItemTemplate>
                    </ComboBox>

                </StackPanel>
                <StackPanel Margin="2" Orientation="Horizontal">
                    <Label Content="Top Margin:"
                           Foreground="#FFD1D1D1"
                           Width="80"
                           HorizontalAlignment="Right"
                           FontWeight="Bold" />
                    <ComboBox SelectedValue="{Binding Path=Default.MarginTop}"
                              ItemsSource="{Binding Source={StaticResource margins}}"
                              Width="50">
                        <ComboBox.ItemTemplate>
                            <DataTemplate>
                                <StackPanel Margin="1"
                                            Orientation="Horizontal">
                                    <TextBlock Text="{Binding}" />
                                </StackPanel>
                            </DataTemplate>
                        </ComboBox.ItemTemplate>
                    </ComboBox>   
                    <Label Content="Text Alignment:"
                           Foreground="#FFD1D1D1"
                           Width="120"
                           HorizontalAlignment="Right"
                           FontWeight="Bold" />
                    <ComboBox SelectedValue="{Binding Path=Default.TextAlign}"
                              ItemsSource="{Binding Source={StaticResource alignments}}"
                              Width="80">
                        <ComboBox.ItemTemplate>
                            <DataTemplate>
                                <StackPanel Margin="1"
                                            Orientation="Horizontal">
                                    <TextBlock Text="{Binding}" />
                                </StackPanel>
                            </DataTemplate>
                        </ComboBox.ItemTemplate>
                    </ComboBox>
                </StackPanel>
                <StackPanel >
                    <TextBlock HorizontalAlignment="Left"
                               Margin="20,10,0,0"
                               FontSize="16"
                               FontWeight="Bold"
                               Foreground="LightGreen"
                               Text="Spelling Options" />
                </StackPanel>
                <StackPanel Margin="2" Orientation="Horizontal">
                    <Label FontWeight="Bold"
                           Foreground="#FFD1D1D1"
                           Content="Language:"
                           Width="80"
                           HorizontalAlignment="Right" />

                    <ComboBox SelectedValue="{Binding Path=Default.Language}"
                              SelectedValuePath="Content"
                              Width="50">
                        <ComboBoxItem Content="" />
                        <ComboBoxItem Content="en" />
                        <ComboBoxItem Content="fr" />
                        <ComboBoxItem Content="de" />
                        <ComboBoxItem Content="es" />
                    </ComboBox>
                    <Label Foreground="#FFD1D1D1"
                           Content="(blank to disable spellcheck)"
                           HorizontalAlignment="Left" />
                </StackPanel>
            </StackPanel>
            <Button Grid.Column="1"
                    Width="30"
                    IsCancel="True"
                    Margin="0,-4,-4,13"
                    Click="Button_Click"
                    FontSize="18"
                    Foreground="DarkRed"
                    FontWeight="Bold"
                    HorizontalAlignment="Right">X</Button>
            <Button Name="okButton"
                    IsDefault="True"
                    Padding="5"
                    Click="Button_Click"
                    Foreground="DarkGreen"
                    FontSize="16"
                    FontWeight="Bold"
                    Height="40"
                    Grid.Column="1"
                    Margin="0,0,24,-78"
                    Grid.Row="1"
                    VerticalAlignment="Bottom"
                    HorizontalAlignment="Right"
                    Width="82">SAVE</Button>
            <Image Name="image1"
                   Stretch="None"
                   Source="/Writespace.Dialogs;component/Resources/Logo_trans_GRAY.png"
                   Margin="-10,-14,10,0"
                   Height="94"
                   Grid.RowSpan="2"
                   VerticalAlignment="Top" />
        </Grid>
    </Grid>
</Window>
